import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:image_gallery_saver/image_gallery_saver.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:yw_bapp/pages/phone_login.dart';
import 'package:yw_bapp/utils/show_tip_pop.dart';
import 'package:yw_bapp/widgets/custom_route_widget.dart';
import 'package:yw_bapp/widgets/loading_pop_widget.dart';
import 'package:yw_bapp/widgets/m_btn.dart';
import 'package:flutter_color_plugin/flutter_color_plugin.dart';
import 'package:yw_bapp/widgets/show_toast.dart';
import 'dart:typed_data';

class FirstPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(color: Colors.white),
      child: Stack(
        children: <Widget>[
          // 背景图
          Center(
            child: Image.asset(
              'images/firstPage.png',
              width: 262,
              height: 435,
            ),
          ),
          // 按钮
          Positioned(
            bottom: 20,
            left: 17,
            right: 17,
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceAround,
              children: <Widget>[
                // 注册按钮
                MBtn(
                  function: () async {
                    // 跳转页面
                    // showAlertDialog(context);
                    // Navigator.push(context, MaterialPageRoute(builder: (context) => PhoneLogin(title: "注册",)));

                    Navigator.of(context).push(CustomRoute(
                        PhoneLogin(
                          title: "注册",
                        ),
                        4));
                  },
                  title: '注册',
                  borderColor: ColorUtil.color('#FFC49226'),
                ),
                // 登陆按钮
                MBtn(
                  function: () {
                    // 跳转页面
                    // Navigator.push(
                    //     context,
                    //     MaterialPageRoute(
                    //         builder: (context) => PhoneLogin(
                    //               title: "登陆",
                    //             )));

                    Navigator.of(context).push(CustomRoute(
                        PhoneLogin(
                          title: "登陆",
                        ),
                        4));
                  },
                  title: '登录',
                  hasBg: true,
                  bgColor: ColorUtil.color('#FFC49226'),
                  borderColor: ColorUtil.color('#FFC49226'),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }


}
